|
|
|
|
|
|
|
(table continued from previous page) |
|
|
|
|
| Method Name | Description | | Exists | Returns a True value if the key name exists underneath a specified section | | SectionGet | Retrieves all the key names and key values from a specified section and returns them in a Variant array |
|
|
|
|
|
|
When you create an instance of the INI class, the Class_Initialize() event automatically sets the ConfigName property to the name of the EXE file for your project. For example, if your project name is Emps, the INI name will be Emps.ini. Class_Initialize() looks for the INI file in the same directory where the EXE is located. This avoids you having to pass in the INI filename to the class. Of course, you can always pass this information in if you want to store the INI file in another location. Heres the Class_Initialize() event for the INI class: |
|
|
|
 |
|
|
|
|
Private Sub Class_Initialize() mstrConfigName = App.Path & "\" & _
App.EXEName & ".ini" End Sub |
|
|
|
|
|
|
|
|
Using the INI Class to Get Data |
|
|
|
|
|
|
|
|
If you click the Get W/Class command button in the sample form, youll see that information can be retrieved from the INI file. The Click event for this command button instantiates an instance of the INI class. Set the values from the text boxes and then invoke the KeyGet() method to retrieve the data. Heres the code: |
|
|
|
 |
|
|
|
|
Private Sub cmdGetClass_Click()
Dim oIni As INI
Set oIni = New INI
With oIni
.ConfigName = Trim$(txtConfig)
.Section = Trim$(txtSection)
.KeyName = Trim$(txtKeyName)
txtKeyValue = .KeyGet
End With |
|
|
|
|
|